# makefile

# execfile:main.o src1.o src2.o
# 	gcc -o execfile main.o \
# 					src1.o \
# 					src2.o \

# 获取Makefile文件所在的绝对路径
ROOT_DIR = $(abspath .)  

COMPILE_PREX ?= arm-none-eabi-

# test1:
# 	@echo $(COMPILE_PREX)

# COMPILE_PREX += xtensa-lx106-elf-

# test2:
# 	@echo $(COMPILE_PREX)

CC=gcc

# 调试信息		
foo = $(A)
A = $(foo)

# define cmds
# 	@echo ${CC}
# 	@echo $(COMPILE_PREX)
# 	@echo $(CFLAGS)
# endef

# test = $(wildcard *.c)
# debug:
# 	echo $(test)

APP_NAME=execfile

#编译所用变量
# OUTPUT_DIR = $(ROOT_DIR)/output/$(APP_NAME)
# OUTPUT_DIR_OBJS = $(OUTPUT_DIR)/objs

${APP_NAME}: CFLAGS = -g -o

${APP_NAME}:main.o src1.o src2.o
	$(CC) ${CFLAGS} ${APP_NAME} main.o src1.o src2.o

OBJ_FILE := main.o src1.o src2.o
C_FILE := $(OBJ_FILE:%.o=%.c)

main.o:main.c ty_log.h
	${CC} -c main.c
	@echo $(C_FILE);

src1.o:src1.c ty_log.h
	${CC} -c src1.c

src2.o:src2.c ty_log.h
	${CC} -c src2.c

#伪目标，不能自定义名称
.PHONY:clean
clean:	
	-rm *.o
